package demo.springcloud.webflux.feign.controller;

import demo.springcloud.webflux.common.entity.Result;
import demo.springcloud.webflux.feign.client.RestClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/feign")
public class FeignController {

    @Autowired
    private RestClient restClient;

    @GetMapping("/user/{id}")
    public Result findUserById(@PathVariable String id) {
        Result result = restClient.findById(id);
        return result;
    }
}
